let t = require;
let  e = module
let  o =  e.exports;
 o.default =  e.exports;

                'use strict';
                console.log("start"),
                    Object.defineProperty(o, '__esModule', {
                        value: !0
                    });
                var n = t('ZlipPacket'),
                    i = (function() {
                        function t() {}
                        return (
                            (t.replaceUrl = function(t) {
                                for (var e = t; - 1 != e.indexOf('.bin');) {
                                    e = e.replace('.bin', '.json');
                                }
                                return e;
                            }),
                            (t.downloadJsons = function(e, o) {
                                var i = cc.loader.getXMLHttpRequest(),
                                    r = 'Load binary data failed: ' + e;
                                i.open('GET', e, !0),
                                    (i.responseType = 'arraybuffer'),
                                    (t.jsonPacket = new n.ZlipPacket(null, !0)),
                                    (i.onload = function() {
                                        var e = i.response;
                                        404 != i.status ?
                                            ((t.jsonPacket = new n.ZlipPacket(e, !0)),
                                                t.init(),
                                                o(null)) :
                                            o({
                                                status: i.status,
                                                errorMessage: r + '(no response)'
                                            });
                                    }),
                                    (i.onerror = function() {
                                        o({
                                            status: i.status,
                                            errorMessage: r + '(error)'
                                        });
                                    }),
                                    (i.ontimeout = function() {
                                        o({
                                            status: i.status,
                                            errorMessage: r + '(time out)'
                                        });
                                    }),
                                    i.send(null);
                            }),
                            (t.downloadBinary = function(e, o) {
                                var n = e.url,
                                    i = cc.loader.getXMLHttpRequest(),
                                    r = 'Load binary data failed: ' + n,
                                    a = t.jsonPacket.readBinary(n);
                                a
                                    ?
                                    o(null, a.buffer) :
                                    (i.open('GET', n, !0),
                                        (i.responseType = 'arraybuffer'),
                                        (i.onload = function() {
                                            var t = i.response;
                                            t
                                                ?
                                                o(null, t) :
                                                o({
                                                    status: i.status,
                                                    errorMessage: r + '(no response)'
                                                });
                                        }),
                                        (i.onerror = function() {
                                            o({
                                                status: i.status,
                                                errorMessage: r + '(error)'
                                            });
                                        }),
                                        (i.ontimeout = function() {
                                            o({
                                                status: i.status,
                                                errorMessage: r + '(time out)'
                                            });
                                        }),
                                        i.send(null));
                            }),
                            (t.downloadText = function(e, o) {
                                var n = e.url;
                                n = t.urlAppendTimestamp(n);
                                var i = cc.loader.getXMLHttpRequest(),
                                    r = 'Load text file failed: ' + n;
                                i.open('GET', n, !0),
                                    i.overrideMimeType &&
                                    i.overrideMimeType('text/plain; charset=utf-8'),
                                    (i.onload = function() {
                                        4 === i.readyState ?
                                            200 === i.status || 0 === i.status ?
                                            o(null, i.responseText) :
                                            o({
                                                status: i.status,
                                                errorMessage: r + '(wrong status)'
                                            }) :
                                            o({
                                                status: i.status,
                                                errorMessage: r + '(wrong readyState)'
                                            });
                                    }),
                                    (i.onerror = function() {
                                        o({
                                            status: i.status,
                                            errorMessage: r + '(error)'
                                        });
                                    }),
                                    (i.ontimeout = function() {
                                        o({
                                            status: i.status,
                                            errorMessage: r + '(time out)'
                                        });
                                    }),
                                    i.send(null);
                            }),
                            (t.downloadJson = function(e, o) {
                                var n = e.url,
                                    i = t.jsonPacket.readString(n);
                                if (i) o(null, JSON.parse(i));
                                else {
                                    var r = cc.loader.getXMLHttpRequest(),
                                        a = 'Load text file failed: ' + n;
                                    r.open('GET', n, !0),
                                        r.overrideMimeType &&
                                        r.overrideMimeType('text/plain; charset=utf-8'),
                                        (r.onload = function() {
                                            4 === r.readyState ?
                                                200 === r.status || 0 === r.status ?
                                                o(null, JSON.parse(r.responseText)) :
                                                o({
                                                    status: r.status,
                                                    errorMessage: a + '(wrong status)'
                                                }) :
                                                o({
                                                    status: r.status,
                                                    errorMessage: a + '(wrong readyState)'
                                                });
                                        }),
                                        (r.onerror = function() {
                                            o({
                                                status: r.status,
                                                errorMessage: a + '(error)'
                                            });
                                        }),
                                        (r.ontimeout = function() {
                                            o({
                                                status: r.status,
                                                errorMessage: a + '(time out)'
                                            });
                                        }),
                                        r.send(null);
                                }
                            }),
                            (t.downloadImage = function(e, o, n, i) {
                                void 0 === n && (n = !0);
                                var r = t.urlAppendTimestamp(e.url);

                                function a() {
                                    i.removeEventListener('load', a),
                                        i.removeEventListener('error', s),
                                        (i.id = e.id),
                                        o(null, i);
                                }

                                function s() {
                                    i.removeEventListener('load', a),
                                        i.removeEventListener('error', s),
                                        'https:' !== window.location.protocol &&
                                        i.crossOrigin &&
                                        'anonymous' === i.crossOrigin.toLowerCase() ?
                                        t.downloadImage(e, o, !1, i) :
                                        o(new Error('err:' + r));
                                }
                                if (
                                    ((i = i || new Image()),
                                        (r = t.replaceUrl(r)),
                                        n && 'file:' !== window.location.protocol ?
                                        (i.crossOrigin = 'anonymous') :
                                        (i.crossOrigin = null),
                                        i.complete && i.naturalWidth > 0 && i.src === r)
                                )
                                    return i;
                                i.addEventListener('load', a),
                                    i.addEventListener('error', s),
                                    (i.src = r);
                            }),
                            (t.urlAppendTimestamp = function(t) {
                                return (
                                    cc.game.config.noCache &&
                                    'string' == typeof t &&
                                    (/\?/.test(t) ?
                                        (t += '&_t=' + (new Date() - 0)) :
                                        (t += '?_t=' + (new Date() - 0))),
                                    t
                                );
                            }),
                            (t.init = function() {
                                cc.loader.addDownloadHandlers({
                                    json: t.downloadJson
                                });
                            }),
                            t
                        );
                    })();
                (o.default = i), console.log("end");
            module.exports =  e.exports;